home *** CD-ROM | disk | FTP | other *** search
/ IRIX Development Foundation 1.1 for IRIX 6.2 / SGI IRIX 6.2 Development Foundation 1.1.iso / dist / patchSG0001645.idb / usr / include / unistd.h.z / unistd.h
C/C++ Source or Header  |  1997-07-01  |  13KB  |  454 lines

  1. #ifndef __UNISTD_H__
  2. #define __UNISTD_H__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #ident "$Revision: 1.106 $"
  7. /*
  8. *
  9. * Copyright 1992-1993, Silicon Graphics, Inc.
  10. * All Rights Reserved.
  11. *
  12. * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  13. * the contents of this file may not be disclosed to third parties, copied or
  14. * duplicated in any form, in whole or in part, without the prior written
  15. * permission of Silicon Graphics, Inc.
  16. *
  17. * RESTRICTED RIGHTS LEGEND:
  18. * Use, duplication or disclosure by the Government is subject to restrictions
  19. * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  20. * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  21. * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  22. * rights reserved under the Copyright Laws of the United States.
  23. */
  24. /*    Copyright (c) 1988 AT&T    */
  25. /*      All Rights Reserved      */
  26.  
  27. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  28. /*    The copyright notice above does not evidence any       */
  29. /*    actual or intended publication of such source code.    */
  30. #include <standards.h>
  31. #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) || defined(_LANGUAGE_ASSEMBLY)
  32.  
  33. /* Symbolic constants for the "access" routine: */
  34. #ifndef F_OK
  35. #define    R_OK    004    /* Test for Read permission */
  36. #define    W_OK    002    /* Test for Write permission */
  37. #define    X_OK    001    /* Test for eXecute permission */
  38. #define    F_OK    000    /* Test for existence of File */
  39. #endif
  40.  
  41. #if _SGIAPI
  42. #define EFF_ONLY_OK     010    /* Test using effective ids */
  43. #define EX_OK        020    /* Test for Regular, executable file */
  44. #endif    /* _SGIAPI */
  45. #endif /* _LANGUAGE_C  _LANGUAGE_C_PLUS_PLUS _LANGUAGE_ASSEMBLY */
  46.  
  47. #if _XOPEN4UX
  48. #define F_ULOCK    0    /* Unlock a previously locked region */
  49. #define F_LOCK    1    /* Lock a region for exclusive use */
  50. #define F_TLOCK    2    /* Test and lock a region for exclusive use */
  51. #define F_TEST    3    /* Test a region for other processes locks */
  52. #endif /* _XOPEN4UX */
  53.  
  54. #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) || defined(_LANGUAGE_ASSEMBLY)
  55.  
  56. /* _daemonize(3C) flags */
  57. #define    _DF_NOFORK    0x1    /* don't fork */
  58. #define    _DF_NOCHDIR    0x2    /* don't chdir to / */
  59. #define    _DF_NOCLOSE    0x4    /* close no files */
  60.  
  61. /* Symbolic constants for the "lseek" routine: */
  62. #ifndef SEEK_SET                /* also defined in stdio.h */
  63. #define    SEEK_SET    0    /* Set file pointer to "offset" */
  64. #define    SEEK_CUR    1    /* Set file pointer to current plus "offset" */
  65. #define    SEEK_END    2    /* Set file pointer to EOF plus "offset" */
  66. #endif /* !SEEK_SET */
  67.  
  68. #if _SGIAPI
  69. /* Path names: */
  70. #define    GF_PATH    "/etc/group"    /* Path name of the "group" file */
  71. #define    PF_PATH    "/etc/passwd"    /* Path name of the "passwd" file */
  72. #endif /* _SGI_API */
  73.  
  74. /* compile-time symbolic constants,
  75. ** Support does not mean the feature is enabled.
  76. ** Use pathconf/sysconf to obtain actual configuration value.
  77. ** 
  78. */
  79.  
  80. #define _POSIX_JOB_CONTROL        1
  81. #define _POSIX_SAVED_IDS        1
  82.  
  83. #if _POSIX93
  84. #define _POSIX_ASYNCHRONOUS_IO        1
  85. #define _POSIX_FSYNC            1
  86. #define _POSIX_MAPPED_FILES        1
  87. #define _POSIX_MEMLOCK            1
  88. #define _POSIX_MEMLOCK_RANGE        1
  89. #define _POSIX_MEMORY_PROTECTION    1
  90. #define _POSIX_MESSAGE_PASSING        1
  91. #define _POSIX_PRIORITY_SCHEDULING    1
  92. #define _POSIX_REALTIME_SIGNALS        1
  93. #define _POSIX_SEMAPHORES        1
  94. #define _POSIX_SHARED_MEMORY_OBJECTS     1
  95. #define _POSIX_SYNCHRONIZED_IO        1
  96. #define _POSIX_TIMERS            1
  97. #endif /* _POSIX93 */
  98.  
  99. #ifndef _POSIX_VDISABLE
  100. #define _POSIX_VDISABLE        0
  101. #endif
  102.  
  103. #ifndef    NULL
  104. #define NULL    0L
  105. #endif
  106.  
  107. #define    STDIN_FILENO    0
  108. #define STDOUT_FILENO    1
  109. #define STDERR_FILENO    2
  110.  
  111. /* Current version of POSIX */
  112. #ifndef _POSIX_VERSION
  113. #define _POSIX_VERSION    199506L
  114. #endif
  115.  
  116. /* Current version of XOPEN */
  117. #ifndef _XOPEN_VERSION
  118. #define _XOPEN_VERSION 4
  119. #endif
  120.  
  121. #ifndef _POSIX2_C_VERSION
  122. #define    _POSIX2_C_VERSION    199209L
  123. #endif
  124.  
  125. #ifndef _POSIX2_VERSION
  126. #define    _POSIX2_VERSION        199209L
  127. #endif
  128.  
  129. #ifndef _XOPEN_XCU_VERSION
  130. #define    _XOPEN_XCU_VERSION    4
  131. #endif
  132.  
  133. #ifndef _XOPEN_XPG4
  134. #define    _XOPEN_XPG4        1
  135. #endif
  136.  
  137. #ifndef _XOPEN_UNIX
  138. #define    _XOPEN_UNIX        1
  139. #endif
  140.  
  141. #ifndef _POSIX2_C_BIND
  142. #define    _POSIX2_C_BIND        1
  143. #endif
  144.  
  145. #ifndef _POSIX2_LOCALEDEF
  146. #define    _POSIX2_LOCALEDEF    1
  147. #endif
  148.  
  149. #ifndef _POSIX2_C_DEV
  150. #define    _POSIX2_C_DEV        1
  151. #endif
  152.  
  153. #ifndef _POSIX2_CHAR_TERM
  154. #define    _POSIX2_CHAR_TERM    1
  155. #endif
  156.  
  157. #ifndef _POSIX2_FORT_DEV
  158. #define    _POSIX2_FORT_DEV    1
  159. #endif
  160.  
  161. #ifndef _POSIX2_FORT_RUN
  162. #define    _POSIX2_FORT_RUN    1
  163. #endif
  164.  
  165. #ifndef _POSIX2_SW_DEV
  166. #define    _POSIX2_SW_DEV        1
  167. #endif
  168.  
  169. #ifndef _POSIX2_UPE
  170. #define    _POSIX2_UPE        1
  171. #endif
  172.  
  173. #ifndef _XOPEN_ENH_I18N
  174. #define    _XOPEN_ENH_I18N        1
  175. #endif
  176.  
  177. /* command names for XPG4/POSIX2 confstr */
  178. #define _CS_PATH                1
  179. #define _CS_HOSTNAME            2       /* name of node */
  180. #define _CS_RELEASE             3       /* release of operating system */
  181. #define _CS_VERSION             4       /* version field of utsname */
  182. #define _CS_MACHINE             5       /* kind of machine */
  183. #define _CS_ARCHITECTURE        6       /* instruction set arch */
  184. #define _CS_HW_SERIAL           7       /* hardware serial number */
  185. #define _CS_HW_PROVIDER         8       /* hardware manufacturer */
  186. #define _CS_SRPC_DOMAIN         9       /* secure RPC domain */
  187. #define _CS_INITTAB_NAME        10      /* name of inittab file used */
  188. #define _CS_SYSNAME             11      /* name of operating system */
  189.  
  190. #if _POSIX1C
  191. /*
  192.  * POSIX1C options
  193.  */
  194. #define _POSIX_THREADS                1
  195. #define _POSIX_THREAD_SAFE_FUNCTIONS        1
  196. #define _POSIX_THREAD_PRIORITY_SCHEDULING    1
  197. #define _POSIX_THREAD_ATTR_STACKADDR        1
  198. #define _POSIX_THREAD_ATTR_STACKSIZE        1
  199. #define _POSIX_THREAD_PRIO_INHERIT        1
  200. #define _POSIX_THREAD_PRIO_PROTECT        1
  201. #endif
  202.  
  203. #include <sys/types.h>
  204. #include <sys/unistd.h>
  205.  
  206. /*
  207.  * POSIX 1003.1 Functions
  208.  */
  209. extern int access(const char *, int);
  210. extern unsigned alarm(unsigned);
  211. extern int chdir(const char *);
  212. extern int chown(const char *, uid_t, gid_t);
  213. extern int close(int);
  214. extern char *ctermid(char *);
  215. extern char *cuserid(char *);
  216. extern int dup(int);
  217. extern int dup2(int, int);
  218. extern int execl(const char *, const char *, ...);
  219. extern int execle(const char *, const char *, ...);
  220. extern int execlp(const char *, const char *, ...);
  221. extern int execv(const char *, char *const *);
  222. extern int execve(const char *, char *const *, char *const *);
  223. extern int execvp(const char *, char *const *);
  224. extern void _exit(int);
  225. extern pid_t fork(void);
  226. extern long fpathconf(int, int);
  227.  
  228. extern char *getcwd(char *, size_t);    /* POSIX flavor of getcwd */
  229. extern gid_t getegid(void);
  230. extern uid_t geteuid(void);
  231. extern gid_t getgid(void);
  232. #if defined(_BSD_COMPAT)
  233. extern int getgroups(int, int *);
  234. #else
  235. extern int getgroups(int, gid_t *);
  236. #endif /* _BSD_COMPAT */
  237. extern char *getlogin(void);
  238. #if defined(_BSD_COMPAT)
  239. extern int getpgrp(int);
  240. #else
  241. extern pid_t getpgrp(void);
  242. #endif
  243. extern pid_t getpid(void);
  244. extern pid_t getppid(void);
  245. extern uid_t getuid(void);
  246. extern int isatty(int);
  247. extern int link(const char *, const char *);
  248. extern off_t lseek(int, off_t, int);
  249. extern long pathconf(const char *, int);
  250. extern int pause(void);
  251. extern int pipe(int *);
  252. extern ssize_t read(int, void *, size_t);
  253. extern int rmdir(const char *);
  254. extern int setgid(gid_t);
  255. extern int setpgid(pid_t, pid_t);
  256. extern pid_t setsid(void);
  257. extern int setuid(uid_t);
  258. extern unsigned sleep(unsigned);
  259. extern long sysconf(int);
  260. extern pid_t tcgetpgrp(int);
  261. extern int tcsetpgrp(int, pid_t);
  262. extern char *ttyname(int);
  263. extern int unlink(const char *);
  264. extern ssize_t write(int, const void *, size_t);
  265.  
  266. #if _POSIX93
  267. /*
  268.  * POSIX 1003.1b additions
  269.  */
  270. extern int fdatasync(int);
  271. #endif /*  _POSIX93 */
  272.  
  273. #if _POSIX93 || _XOPEN4
  274. /* 
  275.  * POSIX 1003.1b functions that are also part of XPG4
  276.  */
  277. extern int fsync(int);
  278. #endif /*  _POSIX93 || _XOPEN4 */
  279.  
  280. #if _POSIX93 || _XOPEN4UX
  281. /* 
  282.  * POSIX 1003.1b functions that are also part of XPG4-UX
  283.  */
  284. extern int ftruncate(int, off_t);    
  285. #endif
  286.  
  287. #if _POSIX1C
  288. /*
  289.  * 1003.1c additions
  290.  */
  291. extern int getlogin_r(char *, size_t);
  292. extern int ttyname_r(int, char *, size_t);
  293. #endif
  294.  
  295. #if _POSIX2
  296. /*
  297.  * POSIX.2 additions
  298.  */
  299. #include <getopt.h>
  300. extern size_t   confstr(int, char *, size_t);
  301. #endif /* _POSIX2 */
  302.  
  303. #if _XOPEN4
  304. /*
  305.  * XPG4 additions
  306.  */
  307. extern int chroot(const char *);
  308. extern int nice(int);
  309. extern char     *crypt(const char *, const char *);
  310. extern void     encrypt(char *, int);
  311. extern char     *getpass(const char *);
  312. extern void     swab(const void *, void *, ssize_t);
  313. #endif /* _XOPEN4 */
  314.  
  315. #if _XOPEN4UX
  316. /*
  317.  * XPG4-UX additions
  318.  */
  319. extern int brk(void *);
  320. extern int fchown(int, uid_t, gid_t);
  321. extern int fchdir(int);
  322. extern int getdtablesize(void);
  323. extern long gethostid(void);
  324. extern int getpagesize(void);
  325. extern pid_t getpgid(pid_t);
  326. extern pid_t getsid(pid_t);
  327. extern char *getwd(char *);
  328. extern int lchown(const char *, uid_t, gid_t);
  329. extern int lockf(int, int, off_t);
  330. extern int readlink(const char *, char *, size_t);
  331. extern void *sbrk(ssize_t);
  332. #if defined(_BSD_COMPAT)
  333. extern int setpgrp(int, int);
  334. #else    /* !_BSD_COMPAT */
  335. extern pid_t setpgrp(void);
  336. #endif /* _BSD_COMPAT */
  337. extern int setregid(gid_t, gid_t);
  338. extern int setreuid(uid_t, uid_t);
  339. extern int symlink(const char *, const char *);
  340. extern void sync(void);
  341. extern int truncate(const char *, off_t);
  342. extern useconds_t ualarm(useconds_t, useconds_t);
  343. extern int usleep(useconds_t);
  344. #if !_SGIAPI
  345. /* Only for XPG4-UX since IRIX vfork == fork */
  346. static pid_t vfork(void) { return(__vfork()); }
  347. #endif    /* !_SGIAPI */
  348. /*
  349.  * These are defined in XPG4 in stropts.h, but permit the inclusion of
  350.  * stropts.h to include all of unistd.h, thus it is valid to define them
  351.  * here
  352.  */
  353. extern int fattach(int, const char *);
  354. extern int fdetach(const char *);
  355. extern int ioctl(int, int, ...);
  356.  
  357. #endif /* _XOPEN4UX */
  358.  
  359. /*
  360.  * All other additions go here. These are non-POSIX/XOPEN
  361.  */
  362.  
  363. #if _SGIAPI || defined(_BSD_TYPES) || defined(_BSD_COMPAT)
  364. /* Need to use the same predicate as
  365.  * types.h for inclusion of bsd_types.h/select.h
  366.  */
  367. struct timeval;
  368. extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
  369. #endif
  370.  
  371. /*
  372.  * All SGI specific and non POSIX/XOPEN orphaned calls go here
  373.  */
  374. #if _SGIAPI
  375. #include <sys/uio.h>
  376. #include <utime.h>    /* 4.0 compatibility */
  377. #include <re_comp.h>
  378. struct acct_spi;    /* needed by get/setspinfo */
  379. extern int acct(const char *);
  380. extern int BSDchown(const char *, uid_t, gid_t);
  381. extern int BSDdup2(int, int);
  382. extern int BSDfchown(int, uid_t, gid_t);
  383. extern int BSDgetpgrp(int);
  384. extern int BSDsetpgrp(int, int);
  385. extern int BSDsetgroups(int, int *);
  386. extern int BSDgetgroups(int, int *);
  387. #ifndef _ABI_SOURCE
  388. extern void bset(char *, bitnum_t);
  389. extern void bclr(char *, bitnum_t);
  390. extern int btst(char *, bitnum_t);
  391. extern void bfset(char *, bitnum_t, bitlen_t);
  392. extern void bfclr(char *, bitnum_t, bitlen_t);
  393. extern bitlen_t bftstset(char *, bitnum_t, bitlen_t);
  394. extern bitlen_t bftstclr(char *, bitnum_t, bitlen_t);
  395. #endif /* _ABI_SOURCE */
  396. extern int _daemonize(int, int, int, int);
  397. extern void exit(int);
  398. extern int ftruncate64(int, off64_t);
  399. extern ash_t getash(void);
  400. extern int getdtablehi(void);
  401. extern int getdomainname(char *, int);
  402. extern int gethostname(char *, int);
  403. extern prid_t getprid(void);
  404. extern char *_getpty(int *, int, mode_t, int);
  405. extern int getspinfo(struct acct_spi *);
  406. extern char *gettxt(const char *, const char *);
  407. extern off64_t lseek64(int, off64_t, int);
  408. extern int mincore(caddr_t, size_t, char *);
  409. extern int mpin(void *, size_t);
  410. extern int munpin(void *, size_t);
  411. extern int newarraysess(void);
  412. extern pid_t pcreatel(const char *, const char *, ...);
  413. extern pid_t pcreatelp(const char *, const char *, ...);
  414. extern pid_t pcreatev(const char *, char *const *);
  415. extern pid_t pcreateve(const char *, char *const *, char *const *);
  416. extern pid_t pcreatevp(const char *, char *const *);
  417. extern ssize_t pread(int, void *, size_t, off64_t);
  418. extern int profil(unsigned short *, unsigned int, unsigned int, unsigned int);
  419. extern int ptrace(int, pid_t, int, int);
  420. extern ssize_t pwrite(int, const void *, size_t, off64_t);
  421. extern int rename(const char *, const char *);    /* added in 1003.1b */
  422. extern float _sqrt_s(float);
  423. extern double _sqrt_d(double);
  424. extern int setash(ash_t);
  425. extern int setspinfo(struct acct_spi *);
  426. extern int setdomainname(const char *, int);
  427. #if defined(_BSD_COMPAT)
  428. extern int setgroups(int, int *);
  429. #else    /* !_BSD_COMPAT */
  430. extern int setgroups(int, const gid_t *);
  431. #endif /* _BSD_COMPAT */
  432. extern int sethostid(int);
  433. extern int sethostname(const char *, int);
  434. extern int seteuid(uid_t);
  435. extern int setruid(uid_t);
  436. extern int setegid(gid_t);
  437. extern int setrgid(gid_t);
  438. extern int setprid(prid_t);
  439. extern int sgikopt(const char *, char *, int);
  440. extern long sginap(long);
  441. extern int stime(const time_t *);
  442. extern off_t tell(int);
  443. extern off64_t tell64(int);
  444. extern int truncate64(const char *, off64_t);
  445. extern int vhangup(void);
  446. #endif     /* _SGIAPI */
  447.  
  448. #endif /* _LANGUAGE_C  _LANGUAGE_C_PLUS_PLUS  _LANGUAGE_ASSEMBLY */
  449.  
  450. #ifdef __cplusplus
  451. }
  452. #endif
  453. #endif /* !__UNISTD_H__ */
  454.